<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Promise.prototype.then()、Promise.prototype.catch()、Promise.prototype.finally()</title>
</head>

<body>
    <script>
        const myPromise = new Promise((resolve, reject) => {
            setTimeout(() => {
                // resolve('foo');
                reject('err');
            }, 300);
        });

        myPromise
            .then(res => {
                console.log(res)
            }, err => {
                console.log(err)
            })
            .catch(err => {
                console.log(err)
            })
            .finally(() => {
                console.log('finally')
            })
    </script>
</body>

</html>